﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.RobotJog.CanSetLocationParamConverter
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Data;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.RobotJog;

public class CanSetLocationParamConverter : IMultiValueConverter
{
  public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
  {
    if (value.Length != 0)
    {
      ITxRoboticLocationOperation locationOperation = value[0] as ITxRoboticLocationOperation;
      bool flag1 = true;
      bool flag2 = true;
      if (value.Length > 1 && locationOperation != null)
      {
        flag1 = (bool) value[1];
        if (value.Length > 2 && locationOperation.ParentRoboticOperation != null && locationOperation.ParentRoboticOperation.Robot != null)
          flag2 = ((Collection<ITxObject>) locationOperation.ParentRoboticOperation.Robot.ExternalAxes).Count > 0;
      }
      if (locationOperation != null & flag1 & flag2)
        return (object) true;
    }
    return (object) false;
  }

  public object[] ConvertBack(
    object value,
    Type[] targetType,
    object parameter,
    CultureInfo culture)
  {
    throw new NotSupportedException();
  }
}
